/*
 * package com.gate.sec;
 * 
 * import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import
 * java.io.IOException; import java.io.InputStream;
 * 
 * import javax.servlet.ReadListener; import javax.servlet.ServletInputStream;
 * import javax.servlet.ServletRequest; import
 * javax.servlet.http.HttpServletRequest; import
 * javax.servlet.http.HttpServletRequestWrapper;
 * 
 * import org.apache.commons.io.IOUtils;
 * 
 * import com.alibaba.fastjson.JSONObject; import com.game.utils.StringUtils;
 * 
 *//**
	 * 
	 * @author
	 *
	 */
/*
 * public class RequestWrapper extends HttpServletRequestWrapper {
 * 
 * public RequestWrapper(HttpServletRequest request) { super(request); }
 * 
 * @Override public ServletInputStream getInputStream() throws IOException {
 * String requestData = getRequestJson(getRequest()); String decodeStr =
 * easpString(requestData); ServletInputStream servletInputStream = new
 * ServletInputStream() { public int read() throws IOException { return
 * IOUtils.toInputStream(decodeStr).read(); }
 * 
 * @Override public boolean isFinished() { return false; }
 * 
 * @Override public boolean isReady() { return false; }
 * 
 * @Override public void setReadListener(ReadListener listener) {
 * 
 * }; }; return servletInputStream; }
 * 
 * public String easpString(String requestData) { requestData =
 * JSONObject.parseObject(requestData).toJSONString(); if (requestData != null
 * && !requestData.equals("")) { if
 * (!requestData.startsWith("{\"requestData\":")) { throw new
 * RuntimeException("参数【requestData】缺失异常！"); } else { int closeLen =
 * requestData.length() - 1; int openLen = "{\"requestData\":".length(); String
 * result = StringUtils.substring(requestData, openLen, closeLen); return
 * result; } } return ""; }
 * 
 *//**
	 * 从request中获取body json字符串进行验证解析
	 * 
	 * @param request
	 * @return
	 * @throws IOException
	 *//*
		 * private String getRequestJson(ServletRequest request) throws IOException {
		 * InputStream in = request.getInputStream(); int length = 0;
		 * ByteArrayOutputStream bos = null; DataOutputStream output = null; try { bos =
		 * new ByteArrayOutputStream(); output = new DataOutputStream(bos); byte[] data
		 * = new byte[4096]; // int totalLen = 0; while ((length = in.read(data, 0,
		 * data.length)) != -1) { output.write(data, 0, length); // totalLen +=length; }
		 * byte[] bytes = bos.toByteArray(); String text = new String(bytes, "UTF-8");
		 * return text; } finally { if (output != null) { output.close(); } } } }
		 */